<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__PUBLIC__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Service/common/center/index.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Service/common/order/page01.css" rel="stylesheet" type="text/css" />
	<!-- <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> -->
	<!--[if IE 6]>
	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>客服中心</title>
	<style>
		.cursor_not{cursor: not-allowed;}
		.mb{margin-bottom: 1px}
	</style>
</head>
<body>
<include file="Tpl/Service/header.html"/>
	
		<assign name='getTel' value="$Think.get.tel"/>
		<assign name="getCommunity" value="$Think.get.community_id"/>
		<assign name="getType" value="$Think.get.selectType"/>
	<div class="content">
		<div class="pd-20">
		</div>
		<div class="text-c" style="margin-bottom: 40px">
			<form action="" method="get"  autocomplete="off" class="sugForm" style="display: inline;">
			<input type="hidden" name="step" value="{$Think.get.step}"/>
			 日期范围：
		        <input onfocus="WdatePicker()" id="datemin" class="input-text Wdate" name="start_time" value="{$Think.get.start_time}" style="width:120px;" type="text">
		        -
		        <input onfocus="WdatePicker()" name="end_time" id="datemax" class="input-text Wdate" value="{$Think.get.end_time}" style="width:120px;margin-right: 56px" type="text">
				<input type="hidden" value="Service" name="m"/>
				<input type="hidden" value="Order" name="c"/>
				<input type="hidden" value="lst" name="a"/>
				<input type="hidden" value="{$Think.get.tel}" name="tel"/>
				<span class="select-box" style="width: 140px;margin-right: 20px">
					<select name="community_id" class="select community_id" id="community_id" value="{$Think.get.community_id}">
						<option value="">请选择小区</option>
						<volist name="communityData" id="v">
						<option value="{$v.id}" {$getCommunity==$v['id']?'selected':''}>{$v.name}</option>
						</volist>
					</select>
				</span>
				<span class="select-box" style="width: 140px;margin-right: 20px">
					<select name="selectType" class="select " id="selectType" value="">
						<option value="">请选择类型</option>
						<option value="1" {$getType==1?'selected':''}>报修人</option>
						<option value="2" {$getType==2?'selected':''}>创建人</option>
						<option value="3" {$getType==3?'selected':''}>指派人</option>
						<option value="4" {$getType==4?'selected':''}>地址</option>
						<option value="5" {$getType==5?'selected':''}>事件说明</option>
						<option value="6" {$getType==6?'selected':''}>流水号</option>
					</select>
				</span>
				<input type="text" class="input-text searchKey" style="width:300px" placeholder="输入关键词搜索" value="{$Think.get.keyword}" id="keyword" name="keyword">

				
				<button type="submit" class="btn btn-success radius searchButton" id="searchBtn" name=""><i class="Hui-iconfont">&#xe665;</i>搜索</button>
				
			</form>
			
		</div>
		<assign name="getStep" value="$Think.get.step"/>
		<div class="cl pd-5 bg-1 bk-gray mt-20 mb-20">
			<span class="l">
				<a href="{:U('lst',array('step'=>10))}" class="btn radius familyDelBat {$getStep==10?' btn-primary':'btn-default'}">
					全部
				</a>
				<a href="{:U('lst',array('step'=>1))}" class="btn radius familyDelBat {$getStep==1?' btn-primary':'btn-default'}">
					未处理
				</a>
				<a href="{:U('lst',array('step'=>2))}" class="btn radius familyDelBat {$getStep==2?' btn-primary':'btn-default'}">
					完成
				</a>
				<a href="{:U('lst',array('step'=>3))}" class="btn radius familyDelBat {$getStep==3?' btn-primary':'btn-default'}">
					未完成
				</a>
				<a href="{:U('lst',array('step'=>-1))}" class="btn radius familyDelBat {$getStep==-1?' btn-primary':'btn-default'}">
					取消
				</a>
			</span>
		</div>
<input type="hidden" name="nowId" id="nowId" value="{$data[0]['id']}"/>
<input type="hidden" name="getStep" id="getStep" value="{$getStep}"/>
		<table class="table table-border table-bordered table-bg" id="orderTable">
			<thead>
				<tr>
					<th scope="col" colspan="14">咨询帮助</th>
				</tr>
				<tr class="text-c" role="row">
					<th width="40">订单编号</th>
					<th width="180">工单状态</th>
					<th width="180">工单大类</th>
					<th width="160">工单细类</th>
					<th width="800">事件说明</th>
					<th width="100">项目</th>
					<th width="140">报修人</th>
					 <th width="80">报修人号码</th>
					<th width="120">地址</th>
					<th width="100">创建时间</th>
					 <th width="100">创建人</th>
					 <th width="100">指派人</th>
					 <th width="100">完成说明</th>
					<th width="80">操作</th>
				</tr>
			</thead>
               
			<tbody class="perTableTbody">
			<tr id="roll"></tr>
			 <!--<?php myDump($data); ?>-->
				<volist name="data" id="v">
				   <tr class="text-c" class="odd" role="row">
					   <td width="40">{$v.serialno}</td>
					   <!-- <td width="180">{$v.step_title}</td> -->
					   <td width="180">{$v['step_title']}</td>
					   <td width="180">{$v['type_name']}</td>
					   <td width="160">{$v.entry_name}</td>
					   <td width="800">{$v.info}</td>
					   <td width="100">{$v.community_name}</td>
					   <td width="140">{$v.realname}</td>
					    <td width="80">{$v.tel}</td>
					   <td width="120">{$v.address}</td>
					   <td width="100">{$v.create_time}</td>
					   <td width="100">{$v.service_name}</td>
					   <td width="100">{$v.handler_name}</td>
					   <td width="100">{$v.remark}</td>
					   <td width="80">
					   	<a href="javascript:to('{:U('Order/doneMsg',['id'=>$v['id']])}');"   class="label label-secondary radius  done" >完成</a>
					   	<a href="javascript:to1('{:U('Order/unDoneMsg',['id'=>$v['id']])}');" class="label label-secondary radius  unDone" >未完成</a>
					   	<a href="javascript:to2('{:U('Order/appoint',['id'=>$v['id']])}');" class="label label-secondary radius" >指派</a>
					   	<a href="javascript:to3('{:U('Order/off',['id'=>$v['id']])}');" class="label label-secondary radius" >取消工单</a>
					   </td>
				   </tr>
			   </volist>
			</tbody>
		</table>
		<div style="text-align: center;" class="mt-20">{$page}</div>
		
	</div>
		<input type="hidden" name="" id="nowp" value="{$Think.get.p}"/>
		<input type="hidden" name="" id="orderManage" value="{$orderManage}"/>
		
	</div>

	
	
<!--
	     
	    <iframe src="/index.php?m=Service&c=Order&a=orderList&customerId={$data[0].id}" frameborder="0" id="order"><input type="button" onclick="javascript:window.top.close();" value="关闭" /></iframe>
-->
	
	
	
	<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.admin.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/getUrl.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<!--<script type="text/javascript" src="Tpl/Service/common/center/index.js"></script>-->
	<!-- <script type="text/javascript" src="Tpl/Service/common/order/lunxun.js"></script> -->
	<script type="text/javascript" src="/Public/lib/My97DatePicker/WdatePicker.js"></script>
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script type="text/javascript">
	// 全局
		var info={
			id:0,//业主id
			tel:''
		};

	$(function(){
		info.id=$("#createOrder").attr("uid");
		info.tel=$.getUrlVar('tel');
		work.init();
	});
        
//功能实现
        var work={
	/*·····························初始化························*/
	init:function(){
		this.eventListen();
	},
	/*·····························事件监听························*/
	eventListen:function(){
		$(".telInfo").text(info.tel);
		// // 创建工单
		// $(document).on("click","#createOrder",function(){
		// 	var url='/index.php?m=Service&c=Order&a=create&id='+info.id;
		// 	var title="创建工单";
		// 	work.layerOpen(title,url);
            
		// });
		// //编辑用户
		// $(document).on("click","#customerEdit",function(){
		// 	var url='/index.php?m=Service&c=Center&a=edit&id='+info.id+'&tel='+info.tel;
		// 	var title="客户编辑";
		// 	work.layerOpen(title,url);
		// });
		// // 切换用户
		// $(document).on("click","#changeUser",function(){
		// 	if(info.tel==undefined){
		// 		info.tel='';
		// 	}
		// 	window.location.href="/index.php?m=Service&c=Center&a=choice&tel="+info.tel;
		// });
		 //搜索
		 $(document).on("click","#search",function(){
		 	var tel=$("#searchTel").val();
		 	var name=$("#searchName").val();
		 	var phone=$("#searchPhone").val();
		 	window.location.href='/index.php?m=Service&c=Center&a=choice&tel='+tel+'&name='+name+'&phone='+phone;
		 });
//		// 查看所有工单
//		$(document).on("click","#seeOrder",function(){
//			var id=$(this).attr("uid");
//			var title='查看所有工单';
//			var url='/index.php?m=Service&c=Order&a=orderList&customerId='+id;
//			work.layerOpenB(title,url);
//		});
//		// 查看客服所有工单
//		$(document).on("click","#myOrder",function(){
//			var authId={$Think.session.authId};
//			var title='查看所有工单';
//			var url='/index.php?m=Service&c=Order&a=orderList&authId='+authId;
//			work.layerOpenB(title,url);
//		});
		// 查看工单
		$(document).on("click",".infoBtn",function(){
			var id=$(this).attr("uid");
			var title="工单详情";
			var url='/index.php?m=Service&c=Order&a=info&ID='+id;
			work.layerOpen(title,url);
		});
		// 创建用户
		$(document).on("click","#createCustomer",function(){
		if(info.tel.length==11){
				var whatFunc = {tel:info.tel};
				var whatWay = 'tel=';
			}else{
				var whatFunc = {phone:info.tel};
				var whatWay = 'phone=';
			};
			$.post("/index.php?m=Admin&c=Customer&a=add",whatFunc,function(data){
				if(data.stat==1){
					work.layerOpen('创建用户','/index.php?m=Service&c=Center&a=create&'+whatWay+info.tel+'&customerId='+data.pk);
				}else{
					layer.msg(data.msg);
				}
			});
			
		});
		//查看用户更多信息
		$(document).on("click","#customerInfoBtn",function(){
			var id=$(this).attr("uid");
			var url='/index.php?m=Service&c=Center&a=getCustomer&id='+id;
			work.layerCap("用户详情",url);
		});
	},
	/*·····························功能性函数························*/
	// iframe页面弹窗
	layerOpen:function(title,url){
		layer.open({
			type: 2,
			area: ['800px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url,
			cancel:function(){
				location.replace(location.href);
			}
		});
	},
	//大弹窗
	layerOpenB:function(title,url){
		layer.open({
			type: 2,
			area: ['980px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url
		});
	},
		//创建用户
	layerCap:function(title,url){
		layer.open({
			type:2,
			shade: false,
		    title: title, //不显示标题
		    area: ['800px', '400px'],
		    content: url, //捕获的元素
		    cancel: function(index){
		        
		    }
		});
	}
}


 $(".borderR dl").hide();
        $(".borderR").mouseenter(
            function(){

                $(this).children("dl").show();
                }
        )

        $(".borderR").mouseleave(
            function(){

                $(this).children("dl").hide();
                }
        ); 

function to(url){
    layer.open({
        type: 2,
        title: '完成原因',
        fix:false,
        maxmin: true,
        area: ['500px', '340px'],
        content: url
    });

}

function to1(url){
    layer.open({
        type: 2,
        title: '未完成原因',
        fix:false,
        maxmin: true,
        area: ['500px', '340px'],
        content: url
    });

}

function to2(url){
    layer.open({
        type: 2,
        title: '指派',
        fix:false,
        maxmin: true,
        area: ['300px', '260px'],
        content: url
    });

}

function to3(url){
    layer.open({
        type: 2,
        title: '取消工单',
        fix:false,
        maxmin: true,
        area: ['300px', '260px'],
        content: url
    });

}



// $(function () {
//   $('[data-toggle="tooltip"]').tooltip()
// });

$(document).on("click","#export_account",function(){
            var start_time = $("#datemin").val();
            var end_time = $("#datemax").val();
            var step = $("#getStep").val();;
            var key = $("#searchName").val();
            var community_id = $(".community_id option:selected").val();
			var selectType = $(".selectType option:selected").val();
            var url='/index.php?m=Service&c=WxOrder&a=dumpExcel&key='+key+'&step={$getStep}&start_time='+start_time+'&end_time='+end_time+'&community_id='+community_id+'&selectType='+selectType;
            window.open(url);
        });


// $(document).on("click",".done",function(){
// 	var id = $(this).attr("uid");
// 	var index = layer.confirm('确认完成' , {
//         title: false
//    },function() {
//       layer.close(index);
//       $.get('/index.php?m=Service&c=Order&a=done&id='+id,
//       	function(data){
// 			if(data.status==1){
//                       layer.msg('操作完成');
//                       var index = parent.layer.getFrameIndex(window.name);
//                       setTimeout(function(){
//                            parent.layer.close(index);
//                       },1500);
//                       parent.location.reload();

//                   }else{
//                     layer.msg("操作失败");
//                   }
//                   })
	
            
//           })
// });

// $(document).on("click",".unDone",function(){
// 	var id = $(this).attr("uid");
// 	var index = layer.confirm('确认未完成' , {
//         title: false
//    },function() {
//       layer.close(index);
//       $.get('/index.php?m=Service&c=Order&a=unDone&id='+id,
//       	function(data){
// 			if(data.status==1){
//                       layer.msg('操作完成');
//                       var index = parent.layer.getFrameIndex(window.name);
//                       setTimeout(function(){
//                            parent.layer.close(index);
//                       },1500);
//                       parent.location.reload();

//                   }else{
//                     layer.msg("操作失败");
//                   }
//                   })
	
            
//           })
// });


// $(document).on("click",".unDone",function(){
// 	var id = $(this).attr("uid");
// 	var index = layer.confirm('确认未完成' , {
//         title: false
//    },function() {
//       layer.close(index);
// 	$.ajax({
// 		type:'get',
// 		url:'/index.php?m=Service&c=Order&a=unDone&id='+id,
// 		data:{},
// 		success:function(data){
// 			if(data.status==1){
//                       layer.msg('操作完成');
//                       var index = parent.layer.getFrameIndex(window.name);
//                       setTimeout(function(){
//                            parent.layer.close(index);
//                       },1500);
//                       parent.location.reload();

//                   }else{
//                     layer.msg('操作失败');
//                   }
//                   }
//                 });
//              return false; 
            
//           })
// 	});


	</script>
	</body>
	</html>